#include "point.hpp"

Point::Point(double x, double y) : x(x), y(y)
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
Point::~Point()
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
double Point::distance(const Point &p)
{
    return std::sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
}
Point &Point::operator++()
{
    x++;
    return *this;
}
Point &Point::operator--()
{
    x--;
    return *this;
}
Point Point::operator++(int n)
{
    Point tmp = *this;
    y++;
    return tmp;
}
Point Point::operator--(int n)
{
    Point tmp = *this;
    y--;
    return tmp;
}
std::istream &operator>>(std::istream &in, Point &p)
{
    std::cout << "Please input Point's x and y:" << std::endl;
    in >> p.x >> p.y;
    return in;
}
std::ostream &operator<<(std::ostream &out, const Point &p)
{
    std::cout << '(' << p.x << ',' << p.y << ')' << std::endl;
    return out;
};